﻿using System.Collections.Generic;
using IQIGame.Onigao.GamePlay;

namespace IQIGame.Onigao.Logic
{
    [SerializableGroup(SerializableGroup.StoryModuleConfig)]
    public partial class StoryNode_Normal : SerializeCustomConfig
    {
        public string contents;
        public string speaker;
        public int backgroundType;
        public string background;
        public int speakerID;
    }

    [SerializableGroup(SerializableGroup.StoryModuleConfig)]
    public partial class StoryNode_End : SerializeCustomConfig
    {
        public List<int> service = new List<int>();
    }

    [SerializableGroup(SerializableGroup.StoryModuleConfig)]
    public partial class StoryNode_Option : SerializeCustomConfig
    {
        public List<StoryChooseConfig> choose = new List<StoryChooseConfig>();
        public bool stopSkip; // 阻断跳过
    }

    [SerializableGroup(SerializableGroup.StoryModuleConfig)]
    public partial class StoryChooseConfig : SerializeCustomConfig
    {
#if UNITY_EDITOR
        [ListViewField(true, "内容")]
#endif
        public string contents;
#if UNITY_EDITOR
        [ListViewField(true, "触发服务")]
#endif
        public List<int> service;
#if UNITY_EDITOR
        [ListViewField(true, "展示条件")]
#endif
        public int conditionShow;
#if UNITY_EDITOR
        [ListViewField(true, "选择条件")]
#endif
        public int conditionSelect;
#if UNITY_EDITOR
        [ListViewField(true, "跳转ID")]
#endif
        public int jumpID;
    }

    [SerializableGroup(SerializableGroup.StoryModuleConfig)]
    public partial class StoryNode_Timeline : SerializeCustomConfig
    {
        public string timeline;
    }

    [SerializableGroup(SerializableGroup.StoryModuleConfig)]
    public partial class StoryNode_Remove3DNpc : SerializeCustomConfig
    {
        public int npc;
    }

    [SerializableGroup(SerializableGroup.StoryModuleConfig)]
    public partial class StoryNode_Effect : SerializeCustomConfig
    {
        public string effect;
    }

    [SerializableGroup(SerializableGroup.StoryModuleConfig)]
    public partial class StoryNode_CenterContents : SerializeCustomConfig
    {
        public string contents;
    }

    [SerializableGroup(SerializableGroup.StoryModuleConfig)]
    public partial class StoryNode_Speaker : SerializeCustomConfig
    {
        public List<StorySpeakerConfig> speaker = new List<StorySpeakerConfig>(5);
    }

    [SerializableGroup(SerializableGroup.StoryModuleConfig)]
    public partial class StorySpeakerConfig : SerializeCustomConfig
    {
#if UNITY_EDITOR
        [ListViewField(true, "NpcID")] [CfgIdSelector("StoryNpc")]
#endif
        public int npc;
#if UNITY_EDITOR
        [ListViewField(true, "说话人类型")]
#endif
        public EStorySpeakerType speakerType;
#if UNITY_EDITOR
        [ListViewField(true, "行为ID")]
#endif
        public int action;
#if UNITY_EDITOR
        [ListViewField(true, "是否作为主说话人")]
#endif
        public bool active;

        public enum EStorySpeakerType
        {
            Image,
            Live2D,
            Spine,
        }
    }

    [SerializableGroup(SerializableGroup.StoryModuleConfig)]
    public partial class StoryNode_Bgm : SerializeCustomConfig
    {
#if UNITY_EDITOR
        [VisualElementField("bgm"), CfgIdSelector("Audio")]
#endif
        public int bgm;
#if UNITY_EDITOR
        [VisualElementField("bgm类型")]
#endif
        public EStoryBgmType bgmType;

        public enum EStoryBgmType
        {
            Add,
            Switch,
            Stop
        }
    }

    [SerializableGroup(SerializableGroup.StoryModuleConfig)]
    public partial class StoryNode_Video : SerializeCustomConfig
    {
#if UNITY_EDITOR
        [VisualElementField("视频")]
#endif
        public string video;
    }

    [SerializableGroup(SerializableGroup.StoryModuleConfig)]
    public partial class StoryNode_BackgroundAction : SerializeCustomConfig
    {
#if UNITY_EDITOR
        [VisualElementField("背景行为")]
#endif
        public int action;

#if UNITY_EDITOR
        [VisualElementField("在End行为结束后主动移除背景")]
#endif
        public bool deleteAfterAction;
    }
}